<script language="javascript">
var gRowId = 1;
var error= new Array(10);
function delRow(button)
	{
	var row = button.parentNode.parentNode;
	var tbody = document.getElementById('data_entry').getElementsByTagName('tbody')[0];
	tbody.removeChild(row);
	}
function defaultRow()
	{
	var gRowId = 0;
	for(i=0;i<1;i++)
		{
		var tbody = document.getElementById('data_entry').getElementsByTagName('tbody')[0];
	
		var row = document.createElement('TR');
		row.className="row2";
	
		<?php
		foreach($item_details as $key => $element)
			{
			echo "var cell_$key = document.createElement('TD');";
			echo $element;
			echo "if (error[gRowId]) {";
			echo "cell_$key.innerHTML=error[gRowId];";
			echo "};";
			echo "cell_$key.appendChild(var_$key);";
			echo "row.appendChild(cell_$key);";
			}
		?>
		tbody.appendChild(row);
		gRowId++;
		}
	}
function addRow()
	{
	var tbody = document.getElementById('data_entry').getElementsByTagName('tbody')[0];

	var row = document.createElement('TR');
	row.className="row2";

	<?php
	foreach($item_details as $key => $element)
		{
		echo "var cell_$key = document.createElement('TD');";
		echo $element;
		echo "if (error[gRowId]) {";
		echo "cell_$key.innerHTML=error[gRowId];";
		echo "};";
		echo "cell_$key.appendChild(var_$key);";
		echo "row.appendChild(cell_$key);";
		}
	?>
	tbody.appendChild(row);
	gRowId++;
	}
</script>
